﻿namespace 命令模式
{
    // Invoker角色
    public class DocumentInvoker
    {
        DocumentCommand _disCommand;
        DocumentCommand _undCommand;
        DocumentCommand _redCommand;

        public DocumentInvoker(DocumentCommand disCommand, DocumentCommand undCommand, DocumentCommand redCommand)
        {
            _disCommand = disCommand;
            _undCommand = undCommand;
            _redCommand = redCommand;
        }

        public void Display()
        {
            _disCommand.Execute();
        }

        public void Undo()
        {
            _undCommand.Execute();
        }

        public void Redo()
        {
            _redCommand.Execute();
        }
    }
}
